﻿using System;
using System.Collections;
using System.Collections.Generic;
using Data.Entities;

namespace Repository.Interface
{
    /// <summary>
    /// 仓库操作基础接口类
    /// </summary>
    /// <typeparam name="TEntity">泛型实体</typeparam>
    public interface IRepositoryBase<TEntity> where TEntity : EntityBase
    {
        #region 根据主键获取数据
        /// <summary>
        /// 根据主键获取数据
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns></returns>
        TEntity Get(object id);
        #endregion

        #region 新增
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity">实体</param>
        void Add(TEntity entity);
        #endregion

        #region 根据主键删除（逻辑删除）
        /// <summary>
        /// 根据主键删除（逻辑删除）
        /// </summary>
        /// <param name="id">主键</param>
        void Delete(object id);
        #endregion

        #region 根据泛型委托获取所有数据
        /// <summary>
        /// 根据泛型委托获取所有数据
        /// </summary>
        /// <param name="func">泛型委托</param>
        /// <returns>实体集合</returns>
        IList<TEntity> FindAll(Func<TEntity, bool> func);
        #endregion
    }
}